/* 
 * File:   hfile.h
 * Author:Gino Biervliet; Kevin Ouwens; Roy Stegers
 *
 * Created on December 15, 2010, 4:33 AM
 */

/*begin standard stuff*/
#include <semaphore.h>
#ifndef HFILE_H
#define	HFILE_H

#ifdef	__cplusplus
extern "C" {
#endif


#ifdef	__cplusplus
}
#endif

#endif	/* HFILE_H */
/*end standard stuff*/

//filepath for communication mmf
#define FILEPATH_COMMCHAN "/tmp/commchan.bin"

#define PORT_NUMBER 5002 // port nr for incomming connection

//rights for opening mmf
#define ACC_RIGHT 0600

#define MAXPENDING 10    //Max number of connections
#define CMDSIZE 50//max commandsize
#define CHUNKSIZE 1460//size of chunks that will be handled
#define ARGSIZE CHUNKSIZE - CMDSIZE //argument is the buffsize -cmndsize


//struct to store different data  for client.
typedef struct{
    int clientNo;       //Clientfd
    int iMapFd;         //File descriptor for clientmmap
    long unsigned amountSent;
    long unsigned amountRead;
    long unsigned totalSent;
    char *cMapFile;     //Pointer for mmap
    char *cMemMapPath;  //Filepath for mmap
    char tempBuffer[CHUNKSIZE];//temporary buffer
    sem_t *semaphoreFull; //semaphore
    sem_t *semaphoreEmpty;//semaphore.
}clientInfo;
